/**
 * #info
 *
 *@author   wuwg
 *@createTime   2018/04/17
 *@updateTime   2018/04/17
 *@description    Casitem  级联动条目
 */
import config from '../../../../config/config.js'
// prefix
const prefixCls = config.prefix + '-cascader'
export default {
  name: 'Casitem',
  props: {
    data: Object,
    tmpItem: Object
  },
  computed: {
    arrowClasses () {
      return [
                `${config.prefix}-icon`,
                `${config.prefix}-icon-ios-arrow-right`
      ]
    },
    loadingClasses () {
      return [
                `${config.prefix}-icon`,
                `${config.prefix}-icon-load-c`,
                `${config.prefix}-load-loop`
      ]
    },
    classes () {
      return [
                `${prefixCls}-menu-item`,
                {
                  [`${prefixCls}-menu-item-active`]: this.tmpItem.value === this.data.value,
                  [`${prefixCls}-menu-item-disabled`]: this.data.disabled
                }
      ]
    },
    showArrow () {
      return (this.data.children && this.data.children.length) || ('loading' in this.data && !this.data.loading)
    },
    showLoading () {
      return 'loading' in this.data && this.data.loading
    }
  }
}
